#ifndef __COMMON_H__
#define __COMMON_H__

#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <stdbool.h>
#include <strings.h>

#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/socket.h>

#include <fcntl.h>
#include <netdb.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <semaphore.h>
#include <netinet/in.h>

#define CONNECTING 0
#define CONNECT_FAIL 1
#define CONNECT_SUCCESS 2

#define SEARCHING 0
#define SEARCH_FAIL 1
#define SEARCH_SUCCESS 2

extern int g_connecting;
extern int g_searching;

// extern sem_t s;
// extern char *filename;

void http_request(char*buf, int size, char *filepath, char *host, int start);
bool check_response(char *httphead);
long long get_size(char *httphead);
long long get_len(char *httphead);

// void arg_parser(char *arg, char **host, char **file);

#endif